<?php

class Admin_ProductController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
        $this->view->headScript()->appendFile($this->view->baseUrl().'/js/jquery-1.8.1.min.js');
    }

    public function newAction()
    {
        // action body
        $form=new Application_Form_NewProduct();
        $this->view->form=$form;
        
        if($this->getRequest()->isPost()){
        	$formData=$this->getRequest()->getPost();
        	if($form->isValid($formData)){
        		$produceModel=new Application_Model_DbTable_Product();
        		$data=array(
        			'product_title'=>$form->getValue('product_title'),
        			'product_url_spell'=>$form->getValue('product_url_spell'),
        			'product_key_words'=>$form->getValue('product_key_words'),
        			'product_seo_description'=>$form->getValue('product_seo_description'),
        			'product_owner_id'=>1,
        			'product_create_date'=>new Zend_Db_Expr('now()'),
        			'product_price'=>$form->getValue('product_price'),
        			'product_promote_price'=>$form->getValue('product_promote_price'),
        			'product_material_type'=>$form->getValue('product_material_type'),
        			'product_use_type'=>$form->getValue('prouct_use_type'),
        			'product_pattern'=>$form->getValue('product_pattern'),
        			'product_taobao_link'=>$form->getValue('product_taobao_link'),
        			'product_location'=>$form->getValue('product_location'),
        			'product_ship_type'=>$form->getValue('product_ship_type'),
        			'product_contact'=>$form->getValue('product_contact'),
        			'product_after_sales'=>$form->getValue('product_after_sales'),
        			'product_is_certificated'=>$form->getValue('product_is_certificate'),
        			'product_text_description'=>$form->getValue('product_text_description')
        		);
        		$produceModel->addNewProduct($data);
        	}
        }
        
        
    }


}



